@extends('layout.main')
@section('content')
    <el-row id="config">
        <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item> 运营管理-扣量规则配置</el-breadcrumb-item>
        </el-breadcrumb>
        <el-form action="/accounts/index" method="get" :model="searchForm" :rules="searchRules" ref="searchForm" label-width="150px" inline="true">
            <el-form-item label="用户ID">
                <el-input name="userID" placeholder="用户ID" v-model="searchForm.userID"></el-input>
            </el-form-item>
            <el-form-item label="游戏ID">
                <el-input name="gameID" placeholder="游戏ID" v-model="searchForm.gameID"></el-input>
            </el-form-item>
            <el-form-item label="统一平台ID">
                <el-input name="tID" placeholder="统一平台ID" v-model="searchForm.tID"></el-input>
            </el-form-item>
            <el-form-item label="游戏昵称">
                <el-input name="gameName" placeholder="游戏昵称" v-model="searchForm.gameName"></el-input>
            </el-form-item>
            <el-form-item label="手机号码">
                <el-input name="Phone" placeholder="手机号码" v-model="searchForm.Phone"></el-input>
            </el-form-item>
            <el-form-item label="最后登录起止时间" name="loginTime" prop="loginTime">
                <el-date-picker @change="dateChange" range-separator='--' v-model="searchForm.loginTime" type="daterange" placeholder="选择日期范围"></el-date-picker>
                <input id="loginTime" type="hidden" name="loginTime" value="">
            </el-form-item>
            <el-form-item  label="会员" prop="delivery">
                <el-switch name="appList" on-text="" off-text="" v-model="searchForm.appList"></el-switch>
            </el-form-item>
            <el-form-item>
                <el-button native-type="submit" @click="submitForm('searchForm')">查询</el-button>
                <el-button @click="resetForm('searchForm')">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" border min-height="300" style="width: 100%">
            <el-table-column label="用户ID" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.UserID}}</span>
                </template>
            </el-table-column>
            <el-table-column label="游戏ID" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.GameID}}</span>
                </template>
            </el-table-column>
            <el-table-column label="统一平台ID" width="150">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.PlatformID}}</span>
                </template>
            </el-table-column>
            <el-table-column label="游戏昵称" width="250">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.NickName}}</span>
                </template>
            </el-table-column>
            <el-table-column label="会员等级" width="100">
                <template scope="scope">
                    <span style="margin-left: 10px">@{{scope.row.MemberOrder}}</span>
                </template>
            </el-table-column>


            <el-table-column label="操作" width="180">
                <template scope="scope">
                    <a href="edit.html" class="icon-operate"><i class="el-icon-edit text-success "></i></a>
                    <i class="el-icon-delete text-info  icon-operate" @click=""></i>
                </template>
            </el-table-column>
        </el-table>
        <el-row tag="div" type="flex" class="" justify="end" style="margin-top:10px;">
            <el-pagination
            @size-change=""
            @current-change="pageChange"
            :current-page.sync="currentPageShow"
            :page-size="{{$pageSize}}"
            layout="total, prev, pager, next ,jumper"
            :total={{$total}}>
            </el-pagination>
        </el-row>
    </el-row>
    <script type="text/javascript">
        var accountInfo = new Vue({
            el: '#index',
            data: {
                currentPageShow:{{$currentPageShow}},
                searchForm: {
                    userID: {!! (isset($this->searchParams['userID']) && $this->searchParams['userID']) ? $this->searchParams['userID'] : "''" !!},
                    gameID: '',
                    tID: '',
                    gameName: '',
                    Phone: '',
                    loginTime: '',
                    appList: false
                },
                searchRules: {

                },
                tableData: {!!$account!!}
            },
            methods:{
                pageChange:function(currentPage){
                    var url = window.location.href;
                    var num=url.indexOf("?");
                    var new_url = '';
                    if(num == -1){ //没有任何参数
                        new_url = '?page='+currentPage;
                    }else {
                        url=url.substr(num+1); //取得所有参数
                        if(url.indexOf("page=") == -1){ //如果不存在page参数
                            new_url = '?'+url+'&page='+currentPage;
                        }else {
                            new_url = url.replace(/page\=\d+/, "page="+currentPage)
                            new_url = '?'+new_url;
                        }
                    }
                    new_url = '/accounts/index'+new_url;
                    window.location.href = new_url
                },
                dateChange:function(date){
                    $("#loginTime").val(date);
                }
            }
        });
    </script>
@endsection
